package appapi.Vo;

import appapi.entity.Zhongjiao.CompanyDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 请求对象
 *
 * @author luocheng
 * @version 1.0
 * @date 2023/05/23 09:49
 */
@ApiModel
@Data
public class EditCompanyVo implements Serializable {
    /**
     * 公司编号
     */
    @NotNull(message = "公司ID不能为空")
    @ApiModelProperty(value = "公司ID",required = true)
    private Integer compId;

    @ApiModelProperty(value = "公司编号")
    private String compCode;

    /**
     * 公司名称
     */
    @ApiModelProperty(value = "公司名称",required = true)
    @NotNull(message = "公司名称不能为空")
    @NotBlank(message = "公司名称不能为空")
    @Length(max = 50)
    private String compName;

    /**
     * 所属机构
     */
    @ApiModelProperty(value = "所属机构",required = true)
    @NotNull(message = "所属机构不能为空")
    private Integer orgaId;

    /**
     * 所属区域
     */
    @ApiModelProperty(value = "所属区域",required = true)
    @NotNull(message = "所属区域不能为空")
    private Integer areaId;

    /**
     * 父级区域
     */
    @ApiModelProperty(value = "父级区域")
    private Integer areaParentId;

    /**
     * 地址
     */
    @ApiModelProperty(value = "地址",required = true)
    @NotNull(message = "地址不能为空")
    @NotBlank(message = "地址不能为空")
    @Length(max = 50)
    private String compAddress;

    /**
     * 经度
     */
    @ApiModelProperty(value = "经度")
    private Double compLongitude;

    /**
     * 纬度
     */
    @ApiModelProperty(value = "纬度")
    private Double compLatitude;

    /**
     * 负责人
     */
    @ApiModelProperty(value = "负责人")
    private String compHead;

    /**
     * 备注说明
     */
    @ApiModelProperty(value = "备注说明")
    private String compNote;

    public CompanyDto vo2Entity(){
        CompanyDto entity = new CompanyDto();
        BeanUtils.copyProperties(this,entity);
        return entity;
    }
}
